home *** CD-ROM | disk | FTP | other *** search
- Peter Custerson spake thus:
- > Could somebody please explain the theory of 4 way scrolling maps
- > to me.
- > At the moment we have a physical screen 320 x 200 Lowres 32 col
- > And a Screen Display (Viewport) of 256 x 192 offset to the
- > center of the screen leaving a block of 32 all the way around
- > the screen. We can scroll all the way around the physical
- > screen, smoothly no trouble at all. How can we make the scrolling
- > area bigger without creating a huge physical screen eating up all
- > our memory?
- >
- > We have tried various methods including -
- > when we reach the end of the physical screen - copy all the
- > relevant blocks to the centre and resetting the viewport, but of
- > course this is very SLOOOOOOW.
- >
- > Could somebody tell me the correct way of doing this, and perhaps
- > provide a piece of AMOS code. If there an AMOS archive somewhere
- > on the net?
- >
- > Thanks in Advance
- >
- > Pete.
-
- OK... sorry I've taken longer than usual to reply to this.
-
- Right, I've done this before, and basically, what I had to do is create
- a screen which is 2x2 times the size of the bit you actually see... then
- you'll have to maintain 4 copies of the bit you're looking at. This
- allows you to gradually scroll further and further to the right, then
- suddenly jump back one screen width without noticable effects. I'll give
- a 2-way scrolling example, because it's more brief, but you can easily
- extend this to 4-way (which is almosy identical to 8-way - I suspect you
- mean 8-way, actually - most people do.)
-
- Right. You have a large screen, and for some odd reason, you want to
- scroll smoothly all the way through large letters of the alphabet
- without creating a screen wide enough for all 26. These are BIG letters,
- and only 4 can fit on the screen at once. You DO NOT want to do it this
- way:
-
- +-------+>>>
- |A B C D|E F G H I J K L M N O P Q R S T U V W X Y Z
- |A B C D|E F G H I J K L M N O P Q R S T U V W X Y Z
- +-------+>>>
-
- You don't want to do it like that, because it would need a huge screen.
- If you, however, create a screen which is JUST OVER twice the width, you
- can do something like this:
-
- +-------+>>>
- |A B C D|E A B C D E
- |A B C D|E A B C D E
- +-------+>>>
-
- You gradually scroll the screen until the "E" has finished appearing,
- then you prepare the next column of the screen:
-
- +-------+>>>
- F|B C D E|F B C D E
- F|B C D E|F B C D E
- +-------+>>>
-
- Note that I'm keeping 2 identical copies of an identical screen. Now,
- keep going, scrolling and preaparing TWO COPIES of the next column,
- until you reach this point:
-
- +-------+>>> +-------+
- F G H I J|F G H I|J Player |F G H I|
- F G H I J|F G H I|J sees: |F G H I|
- +-------+>>> +-------+
-
- Now, if you suddenly jump back a screen-width, the stuff you see on the
- screen is IDENTICAL, so you never notice the change:
-
- +-------+>>> +-------+
- |F G H I|J F G H I J Player |F G H I|
- |F G H I|J F G H I J sees: |F G H I|
- +-------+>>> +-------+
-
- Now you're basically back where you started. You can continue to scroll
- to the right, updating BOTH COPIES of the screen.
-
- Now, I won't repeat all of that for 8-directional scrolling, but
- basically you'll need FOUR copies of the stuff you're seeing, like this:
-
- +-------+
- |A B C D|E A B C D E
- |F G H I|J F G H I J
- +-------+O K L M N O
- A B C D E A B C D E
- F G H I J F G H I J
- K L M N O K L M N O
-
- Now... Something that you may have noticed... In Amos, and a lot of
- other environments... If you scroll OFF THE RIGHT-HAND SIDE of the
- screen, you start seeing the left-hand side again, only shifted up by a
- pixel. When you think about the way screen memory works, this is
- blindingly obvious. In *SOME* circumstances, this single-pixel "jump" is
- unimportant to the game, and you're never going to need to draw anything
- half-way across the gap. *IF* you don't mind these restrictions, you
- don't even need to make your screen twicxe the width - you can just
- scroll into the "next copy" of the same screen, and occasionally jump up
- a pixel to compensate. In most cases, you'll have to put up with a 2x2
- size screen though.
-
- Note! This trick only works HORIZONTALLY! You can scroll off the right
- and "sort of" back on the left, but you absolutely CANNOT do the same
- off the top or bottom... You *WILL* need twice the height.
-
- If you have problems with the above, let me know, but I'm quite busy,
- and off on a skiing holiday soonish, so don't be surprised if I take
- ages replying.
-
- Definite sense of Deja Vu here... Don'tcha reckon, M+F? ;-)
-
-
- Nick Waterman - inet nick@cimio.co.uk - ax25 G7RZQ @ GB7DEO.#32.GBR.EU
- "Go to Red Alert!"... "Sir, are you sure? It DOES mean changing the bulb!"
- None of the opinions above belong to anybody at all, probably.
-
-
-
-